package com.bigchui.DesignPattern.FactoryPattern.EasyFactory;

import com.bigchui.DesignPattern.FactoryPattern.ICourse;

/**
 * Created by wangzhen on 2019/3/9.
 */
public class EasyFactory {
    public ICourse create(String className){
        if(null==className || "".equals(className)){
            return null;
        }else{
            try {
                return (ICourse) Class.forName(className).newInstance();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return null;
    }
}
